CON

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

  CE    = 19
  DS    = 16
  PL    = 17
  CP    = 18
  Q7    = 15

obj

  d     :       "Parallax Serial Terminal"


pub go

  outa[PL]~~
  outa[CE]~~
  
  dira[16..19]~~                'set to output
  dira[Q7]~                     'set to input
  
  

  d.start(115200)

  

  repeat
    

    
    d.bin( get_it, 8)
    waitcnt(cnt + clkfreq/10)
    d.home



pub get_it | temp

  outa[PL]~
  outa[PL]~~

  outa[CE]~

  temp~

  repeat 9
    temp := (ina[Q7]&1) + temp << 1
    outa[CP] := 1    
    outa[CP] := 0
    
  outa[CE]~~
  
  return temp
  